package com.bjbn.tasks;

import com.bjbn.service.IacUserService;
import com.bjbn.service.OrganizationService;
import com.bjbn.service.OrganizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class MyScheduledTasks {

    @Autowired
    private OrganizationService organizationService;

    @Autowired
    private IacUserService iacUserService;

    @Scheduled(cron = "0 */5 * * * *") // 每5分钟执行一次
    public void taskWithCron() {
        System.out.println("Cron定时任务执行，时间: " + new Date());

        organizationService.updateOrganizationAll(null);

        iacUserService.updateIacUserAll(null);
    }
}
